package com.lanqiao.aspectj;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 解决JDBC关闭问题
 */

@Aspect
@Component
public class JdbcAspectj {
    //切点，从何处切入
    @Pointcut("execution(* com.lanqiao.dao.Impl.*.*(..))")
    public void point(){

    }

    @Pointcut("execution(*  org.lanqiao.service.impl.*.*(..))")
    public void point2(){

    }

    @After("point()")
    public void after(){
        System.out.println("关闭了数据库");
    }

    @Before("point()")
    public void before(){
        System.out.println("我来了，打开数据库连接");
    }


}
